#include "bits/stdc++.h"
using namespace std;


class Solution {
public:
    int maxHeightOfTriangle(int red, int blue) {
        int odd = 0;
        int even = 0;
        int res = 0;
        for (int i = 1; i <= 100; ++i) {
            if (i % 2 == 0) {
                even += i;
            }
            else {
                odd += i;
            }
            if (odd <= red && even <= blue) {
                res = i;
                continue;
            }
            if (even <= red && odd <= blue) {
                res = i;
                continue;
            }
            break;
        }
        return res;
    }
};